home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7720 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.pl1,comp.lang.c
  4. Subject: Re: PL/I and C
  5. Date: Wed, 28 Feb 96 12:55:14 GMT
  6. Organization: none
  7. Message-ID: <825512114snz@genesis.demon.co.uk>
  8. References: <4gh5ru$eng@goanna.cs.rmit.EDU.AU> <AD536AAB9668B76CD@mcdialb09.it.luc.edu> <312E363C.3CDE@corp.dialog.com> <TANMOY.96Feb23212936@qcd.lanl.gov> <4h0gn2$mnk@wizvax.wizvax.net>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <4h0gn2$mnk@wizvax.wizvax.net>
  15.            multics@wizvax.wizvax.net "Richard Shetron" writes:
  16.  
  17. >In article <TANMOY.96Feb23212936@qcd.lanl.gov>,
  18. >Tanmoy Bhattacharya <tanmoy@qcd.lanl.gov> wrote:
  19.  
  20. >>Are you claiming that
  21. >> union { int x;
  22. >>        char y[4]; } z;
  23. >>is invalid C? Why?
  24. >
  25. >Is that int x a long int or a short int?
  26.  
  27. Neither. It is an int. long and short are different types.
  28.  
  29. >Last I knew the size of an int was compiler dependent.
  30.  
  31. The size of all of the integer types is compiler dependent. However that
  32. doesn't affect the validity of the example unless it is a requirement that
  33. the char array is the same size (which it isn't in the language). If you
  34. wanted that you could write:
  35.  
  36.  union { int x;
  37.         char y[sizeof(int)]; } z;
  38.  
  39. -- 
  40. -----------------------------------------
  41. Lawrence Kirby | fred@genesis.demon.co.uk
  42. Wilts, England | 70734.126@compuserve.com
  43. -----------------------------------------
  44.